/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package pessoas.ufNonoDigito;

import pessoas.interfaces.IUFNonoDigito;
import pessoas.model.UFNonoDigito;

/**
 *
 * @author Bush
 */
public abstract class AbstractUfNonoDigito implements IUFNonoDigito {

    private IUFNonoDigito next;

    public abstract boolean accept(UFNonoDigito uf);

    public abstract boolean doHandle(UFNonoDigito uf);
    
    @Override
    public final void setNext(IUFNonoDigito next) {
        this.next = next;
    }
    
    @Override
    public boolean handleRequest(UFNonoDigito uf) throws Exception {
        if (accept(uf)) {
            return doHandle(uf);
        } else if (this.next != null) {
            return this.next.handleRequest(uf);
        } else {
            return false;
        }
    }

}
